﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DBUtility;

public partial class Control_ProductInfo_Left : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ControlDataInit();
    }

    protected void ControlDataInit()
    {
        if (Request.QueryString["ProductID"] == null)
        {
            Response.Redirect("ProductList.aspx");
        }
        else
        {
            string ProductID = Request.QueryString["ProductID"].ToString();

            string SQLstr = "SELECT Product.*, ProductClass.PC_Title FROM (Product INNER JOIN ";
            SQLstr += "ProductClass ON Product.Product_ClassID = ProductClass.PC_ID) WHERE (Product.Product_ID = " + ProductID + ")";

            DataTable DT_ProductInfo = AccHelper.GetDataTable(SQLstr);

            IMG_ProductImage.ImageUrl = "~/UploadImage/" + DT_ProductInfo.Rows[0]["Product_Thumbnail"].ToString();
            LB_DateTime.Text = DT_ProductInfo.Rows[0]["Product_DateTime"].ToString();
            LB_ProductClass.Text = DT_ProductInfo.Rows[0]["PC_Title"].ToString();
            LB_Title.Text = DT_ProductInfo.Rows[0]["Product_Title"].ToString();
            LB_Content.Text = DT_ProductInfo.Rows[0]["Product_Content"].ToString();
            LB_Intro.Text = DT_ProductInfo.Rows[0]["Product_Intro"].ToString();
        }
    }
}
